PHP download large file randomly breaks

Last two days, I was trying to make a PHP page to support large file downloading. It’s supposed to be fairly easy because PHP sample code is everywhere. if (file_exists($file) && is_file($file)) { set_time_limit(0); //write HTTP header header(‘Cache-control: private’); header(‘Content-Type: application/octet-stream’); header(‘Content-Length: ‘.filesize($file)); header(‘Content-Disposition: filename=’.basename($file)); $handle = fopen($file, ‘rb’); while (!feof($handle)) { //limited to 256kb/s … Continue reading PHP download large file randomly breaks